package com.yuexun.beilunpatient.ui.bodyCheck.presenter.impl;

import com.yuexun.beilunpatient.ui.bean.BaseListEntity;
import com.yuexun.beilunpatient.ui.bodyCheck.bean.BodyCheckBasicBean;
import com.yuexun.beilunpatient.ui.bodyCheck.bean.BodyCheckHosBean;
import com.yuexun.beilunpatient.ui.bodyCheck.model.IBodyCheckModel;
import com.yuexun.beilunpatient.ui.bodyCheck.presenter.IBasicPresenter;
import com.yuexun.beilunpatient.ui.bodyCheck.ui.view.IBasicView;
import com.yuexun.beilunpatient.ui.bodyCheck.ui.view.IHosView;

import org.kymjs.kjframe.ui.ViewInject;

import java.util.Map;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by Administrator on 2019/4/29 0029.
 */

public class BasicPresenter implements IBasicPresenter{
    private IBasicView view;
    private IBodyCheckModel model;

    public BasicPresenter(IBasicView view, IBodyCheckModel model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void inquireHomdeDocBodyTest(Map<String, String> praise) {
        model.inquireHomdeDocBodyTest(praise)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new Subscriber<BaseListEntity<BodyCheckBasicBean>>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {
                        ViewInject.toast("获取基层体检数据失败:"+e.getMessage());
                    }

                    @Override
                    public void onNext(BaseListEntity<BodyCheckBasicBean> bean) {
                        view.inquireHomdeDocBodyTest(bean);
                    }
                });
    }
}
